home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / SCSL / scfft2d.z / scfft2d
Encoding:
Text File  |  2002-10-03  |  39.7 KB  |  792 lines

  1.  
  2.  
  3.  
  4. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      SSSSCCCCFFFFFFFFTTTT2222DDDD, DDDDZZZZFFFFFFFFTTTT2222DDDD, CCCCSSSSFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD - Applies a two-dimensional real-to-
  10.      complex or complex-to-real Fast Fourier Transform (FFT)
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      Single precision -> Single precision complex
  14.  
  15.           Fortran:
  16.                CCCCAAAALLLLLLLL SSSSCCCCFFFFFFFFTTTT2222DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _y,,,, _l_d_y,,,, _t_a_b_l_e,,,,
  17.                _w_o_r_k,,,, _i_s_y_s))))
  18.  
  19.           C/C++:
  20.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  21.                iiiinnnntttt ssssccccfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,, ffffllllooooaaaatttt *_x,,,,
  22.                iiiinnnntttt _l_d_x,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _l_d_y,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,, ffffllllooooaaaatttt *_w_o_r_k,,,,
  23.                iiiinnnntttt *_i_s_y_s))));;;;
  24.  
  25.           C++ STL:
  26.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  27.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  28.                iiiinnnntttt ssssccccfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,, ffffllllooooaaaatttt *_x,,,,
  29.                iiiinnnntttt _l_d_x,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_y,,,, iiiinnnntttt _l_d_y,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,, ffffllllooooaaaatttt *_w_o_r_k,,,,
  30.                iiiinnnntttt *_i_s_y_s))));;;;
  31.  
  32.      Double precision -> Double precision complex
  33.  
  34.           Fortran:
  35.                CCCCAAAALLLLLLLL DDDDZZZZFFFFFFFFTTTT2222DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _y,,,, _l_d_y,,,, _t_a_b_l_e,,,,
  36.                _w_o_r_k,,,, _i_s_y_s))))
  37.  
  38.           C/C++:
  39.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  40.                iiiinnnntttt ddddzzzzfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,, ddddoooouuuubbbblllleeee
  41.                *_x,,,, iiiinnnntttt _l_d_x,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _l_d_y,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,, ddddoooouuuubbbblllleeee
  42.                *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  43.  
  44.           C++ STL:
  45.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  46.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  47.                iiiinnnntttt ddddzzzzfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,, ddddoooouuuubbbblllleeee
  48.                *_x,,,, iiiinnnntttt _l_d_x,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_y,,,, iiiinnnntttt _l_d_y,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,, ddddoooouuuubbbblllleeee
  49.                *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  50.  
  51.      Single precision complex -> Single precision
  52.  
  53.           Fortran:
  54.                CCCCAAAALLLLLLLL CCCCSSSSFFFFFFFFTTTT2222DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _y,,,, _l_d_y,,,, _t_a_b_l_e,,,,
  55.                _w_o_r_k,,,, _i_s_y_s))))
  56.  
  57.           C/C++:
  58.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  59.                iiiinnnntttt ccccssssfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,,
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  71.  
  72.  
  73.  
  74.                ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _l_d_x,,,, ffffllllooooaaaatttt *_y,,,, iiiinnnntttt _l_d_y,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,,
  75.                ffffllllooooaaaatttt *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  76.  
  77.           C++ STL:
  78.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  79.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  80.                iiiinnnntttt ccccssssfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ffffllllooooaaaatttt _s_c_a_l_e,,,,
  81.                ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_x,,,, iiiinnnntttt _l_d_x,,,, ffffllllooooaaaatttt *_y,,,, iiiinnnntttt _l_d_y,,,, ffffllllooooaaaatttt *_t_a_b_l_e,,,,
  82.                ffffllllooooaaaatttt *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  83.  
  84.      Double precision complex -> Double precision
  85.  
  86.           Fortran:
  87.                CCCCAAAALLLLLLLL ZZZZDDDDFFFFFFFFTTTT2222DDDD ((((_i_s_i_g_n,,,, _n_1,,,, _n_2,,,, _s_c_a_l_e,,,, _x,,,, _l_d_x,,,, _y,,,, _l_d_y,,,, _t_a_b_l_e,,,,
  88.                _w_o_r_k,,,, _i_s_y_s))))
  89.  
  90.           C/C++:
  91.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  92.                iiiinnnntttt zzzzddddfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,,
  93.                ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _l_d_x,,,, ddddoooouuuubbbblllleeee *_y,,,, iiiinnnntttt _l_d_y,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,,
  94.                ddddoooouuuubbbblllleeee *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  95.  
  96.           C++ STL:
  97.                ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>>
  98.                ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>>
  99.                iiiinnnntttt zzzzzzzzfffffffftttt2222dddd ((((iiiinnnntttt _i_s_i_g_n,,,, iiiinnnntttt _n_1,,,, iiiinnnntttt _n_2,,,, ddddoooouuuubbbblllleeee _s_c_a_l_e,,,,
  100.                ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_x,,,, iiiinnnntttt _l_d_x,,,, ddddoooouuuubbbblllleeee *_y,,,, iiiinnnntttt _l_d_y,,,, ddddoooouuuubbbblllleeee *_t_a_b_l_e,,,,
  101.                ddddoooouuuubbbblllleeee *_w_o_r_k,,,, iiiinnnntttt *_i_s_y_s))));;;;
  102.  
  103. IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTAAAATTTTIIIIOOOONNNN
  104.      These routines are part of the SCSL Scientific Library and can be loaded
  105.      using either the ----llllssssccccssss or the ----llllssssccccssss____mmmmpppp option.  The ----llllssssccccssss____mmmmpppp option
  106.      directs the linker to use the multi-processor version of the library.
  107.  
  108.      When linking to SCSL with ----llllssssccccssss or ----llllssssccccssss____mmmmpppp, the default integer size is
  109.      4 bytes (32 bits). Another version of SCSL is available in which integers
  110.      are 8 bytes (64 bits).  This version allows the user access to larger
  111.      memory sizes and helps when porting legacy Cray codes.  It can be loaded
  112.      by using the ----llllssssccccssss____iiii8888 option or the ----llllssssccccssss____iiii8888____mmmmpppp option. A program may use
  113.      only one of the two versions; 4-byte integer and 8-byte integer library
  114.      calls cannot be mixed.
  115.  
  116.      The C and C++ prototypes shown above are appropriate for the 4-byte
  117.      integer version of SCSL. When using the 8-byte integer version, the
  118.      variables of type iiiinnnntttt become lllloooonnnngggg lllloooonnnngggg and the <<<<ssssccccssssllll____fffffffftttt____iiii8888....hhhh>>>> header
  119.      file should be included.
  120.  
  121. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  122.      SSSSCCCCFFFFFFFFTTTT2222DDDD/DDDDZZZZFFFFFFFFTTTT2222DDDD computes the two-dimensional Fast Fourier Transform (FFT)
  123.      of the real matrix _X, and it stores the results in the complex matrix _Y.
  124.      CCCCSSSSFFFFFFFFTTTT2222DDDD/ZZZZDDDDFFFFFFFFTTTT2222DDDD computes the corresponding inverse transform.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  137.  
  138.  
  139.  
  140.      In FFT applications, it is customary to use zero-based subscripts; the
  141.      formulas are simpler that way.  First the function of SSSSCCCCFFFFFFFFTTTT2222DDDD is
  142.      described.  Suppose the arrays are declared as follows:
  143.  
  144.           Fortran:
  145.  
  146.                REAL    X(0:ldx-1, 0:n2-1)
  147.                COMPLEX Y(0:ldy-1, 0:n2-1)
  148.  
  149.  
  150.           C/C++:
  151.  
  152.                float        x[n2][ldx];
  153.                scsl_complex y[n2][ldy];
  154.  
  155.  
  156.           C++ STL:
  157.  
  158.                float          x[n2][ldx];
  159.                complex<float> y[n2][ldy];
  160.  
  161.  
  162.      where _l_d_x >= _n_1, _l_d_y >= (_n_1/2) + 1.
  163.  
  164.      SSSSCCCCFFFFFFFFTTTT2222DDDD computes the formula:
  165.  
  166.                          n2-1  n1-1
  167.      Y(k1, k2) = scale * Sum   Sum [ X(j1, j2)*w1**(j1*k1)*w2**(j2*k2) ]
  168.                          j2=0  j1=0
  169.  
  170.      for _k_1 = 0, ..., _n_1/2 + 1
  171.          _k_2 = 0, ..., _n_2-1
  172.  
  173.  
  174.      where:
  175.  
  176.      _w_1        = exp(_i_s_i_g_n*2*_p_i*_i/_n_1)
  177.  
  178.      _w_2        = exp(_i_s_i_g_n*2*_p_i*_i/_n_2)
  179.  
  180.      _i         = + sqrt(-1)
  181.  
  182.      _p_i        = 3.14159...,
  183.  
  184.      _i_s_i_g_n     = +1 or -1
  185.  
  186.      Different authors use different conventions for which of the transforms,
  187.      _i_s_i_g_n = +1 or _i_s_i_g_n = -1, is the forward or inverse transform, and what
  188.      the _s_c_a_l_e factor should be in either case.  You can make these routines
  189.      compute any of the various possible definitions, however, by choosing the
  190.      appropriate values for _i_s_i_g_n and _s_c_a_l_e.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  203.  
  204.  
  205.  
  206.      The relevant fact from FFT theory is this:  If you take the FFT with any
  207.      particular values of _i_s_i_g_n and _s_c_a_l_e, the mathematical inverse function
  208.      is computed by taking the FFT with -_i_s_i_g_n and 1/(_n_1 * _n_2 * _s_c_a_l_e).  In
  209.      particular, if you use _i_s_i_g_n = +1 and _s_c_a_l_e = 1.0 for the forward FFT,
  210.      you can compute the inverse FFT by using _i_s_i_g_n = -1 and _s_c_a_l_e = 1.0/(_n_1 *
  211.      _n_2).
  212.  
  213.      SSSSCCCCFFFFFFFFTTTT2222DDDD is very similar in function to CCCCCCCCFFFFFFFFTTTT2222DDDD, but it takes the real-
  214.      to-complex transform in the first dimension, followed by the
  215.      complex-to-complex transform in the second dimension.
  216.  
  217.      CCCCSSSSFFFFFFFFTTTT2222DDDD does the reverse.  It takes the complex-to-complex FFT in the
  218.      second dimension, followed by the complex-to-real FFT in the first
  219.      dimension.
  220.  
  221.      See the IIIINNNNTTTTRRRROOOO____FFFFFFFFTTTT(3S) man page for more information about real-to-complex
  222.      and complex-to-real FFTs.  The two-dimensional analog of the conjugate
  223.      formula is as follows:
  224.  
  225.           _Y_k_1, _k_2 = conjg _Y n1 - k, _n_2 - _k_2
  226.  
  227.  
  228.           for _n_1/2 <  _k_1 <= _n_1 - 1
  229.  
  230.  
  231.              0 <= _k_2 <= _n_2 - 1
  232.  
  233.      where the notation conjg(_z) represents the complex conjugate of _z.
  234.  
  235.      Thus, you have to compute only (slightly more than) half of the output
  236.      values, namely:
  237.  
  238.           _Y_k_1, _k_2 for 0 <= _k_1 <= _n_1/2    0 <= _k_2 <= _n_2 - 1
  239.  
  240.  
  241.      See the NOTES section of this man page for information about the
  242.      interpretation of the data types described in the following arguments.
  243.  
  244.      These routines have the following arguments:
  245.  
  246.      _i_s_i_g_n     Integer.  (input)
  247.                Specifies whether to initialize the _t_a_b_l_e array or to do the
  248.                forward or inverse Fourier transform, as follows:
  249.  
  250.                If _i_s_i_g_n = 0, the routine initializes the _t_a_b_l_e array and
  251.                returns.  In this case, the only arguments used or checked are
  252.                _i_s_i_g_n, _n_1, _n_2, and _t_a_b_l_e.
  253.  
  254.                If _i_s_i_g_n = +1 or -1, the value of _i_s_i_g_n is the sign of the
  255.                exponent used in the FFT formula.
  256.  
  257.  
  258.  
  259.  
  260.                                                                         PPPPaaaaggggeeee 4444
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  268.  
  269.  
  270.  
  271.      _n_1        Integer.  (input)
  272.                Transform size in the first dimension.  If _n_1 is not positive,
  273.                the routine returns without calculating a transform.
  274.  
  275.      _n_2        Integer.  (input)
  276.                Transform size in the second dimension.  If _n_2 is not positive,
  277.                the routine returns without calculating a transform.
  278.  
  279.      _s_c_a_l_e     Scale factor.  (input)
  280.                SSSSCCCCFFFFFFFFTTTT2222DDDD: Single precision.
  281.                DDDDZZZZFFFFFFFFTTTT2222DDDD: Double precision.
  282.                CCCCSSSSFFFFFFFFTTTT2222DDDD: Single precision.
  283.                ZZZZDDDDFFFFFFFFTTTT2222DDDD: Double precision.
  284.                Each element of the output array is multiplied by _s_c_a_l_e factor
  285.                after taking the Fourier transform, as defined previously.
  286.  
  287.      _x         Array of dimensions (_l_d_x, _n_2).  (input)
  288.                SSSSCCCCFFFFFFFFTTTT2222DDDD: Single precision array.
  289.                DDDDZZZZFFFFFFFFTTTT2222DDDD: Double precision array.
  290.                CCCCSSSSFFFFFFFFTTTT2222DDDD: Single precision complex array.
  291.                ZZZZDDDDFFFFFFFFTTTT2222DDDD: Double precision complex array.
  292.  
  293.                Array of values to be transformed.
  294.  
  295.      _l_d_x       Integer.  (input)
  296.  
  297.                The number of rows in the _x array, as it was declared in the
  298.                calling program.  That is, the leading dimension of _x.
  299.  
  300.                SSSSCCCCFFFFFFFFTTTT2222DDDD, DDDDZZZZFFFFFFFFTTTT2222DDDD:  _l_d_x >= MMMMAAAAXXXX(_n_1, 1).
  301.                CCCCSSSSFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD:  _l_d_x >= MMMMAAAAXXXX(_n_1/2 + 1, 1).
  302.  
  303.      _y         Array of dimension (_l_d_y, _n_2).  (output)
  304.                SSSSCCCCFFFFFFFFTTTT2222DDDD: Single precision complex array.
  305.                DDDDZZZZFFFFFFFFTTTT2222DDDD: Double precision complex array.
  306.                CCCCSSSSFFFFFFFFTTTT2222DDDD: Single precision array.
  307.                ZZZZDDDDFFFFFFFFTTTT2222DDDD: Double precision array.
  308.  
  309.                Output array of transformed values.  The output array can be
  310.                the same as the input array, in which case, the transform is
  311.                done in place and the input array is overwritten with the
  312.                transformed values.  In this case, it is necessary that the
  313.                following equalities hold:
  314.  
  315.                SSSSCCCCFFFFFFFFTTTT2222DDDD, DDDDZZZZFFFFFFFFTTTT2222DDDD:  _l_d_x = 2 * _l_d_y.
  316.                CCCCSSSSFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD:  _l_d_y = 2 * _l_d_x.
  317.  
  318.      _l_d_y       Integer.  (input)
  319.  
  320.                The number of rows in the _y array, as it was declared in the
  321.                calling program (the leading dimension of _y).
  322.  
  323.  
  324.  
  325.  
  326.                                                                         PPPPaaaaggggeeee 5555
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  334.  
  335.  
  336.  
  337.                SSSSCCCCFFFFFFFFTTTT2222DDDD, DDDDZZZZFFFFFFFFTTTT2222DDDD:  _l_d_y >= MMMMAAAAXXXX(_n_1/2 + 1, 1).
  338.                CCCCSSSSFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD:  _l_d_y >= MMMMAAAAXXXX(_n_1 + 2, 1).
  339.  
  340.                In the complex-to-real routine, two extra elements are in the
  341.                first dimension (_l_d_y >= _n_1 + 2, rather than just _l_d_y >= _n_1).
  342.                These elements are needed for intermediate storage during the
  343.                computation.  On exit, their value is undefined.
  344.  
  345.      _t_a_b_l_e     Array of dimension (_n_1 + _N_F_R) + (2 * _n_2 + _N_F) (input or output)
  346.                SSSSCCCCFFFFFFFFTTTT2222DDDD, CCCCSSSSFFFFFFFFTTTT2222DDDD: Single precision array
  347.                DDDDZZZZFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD: Double precision array
  348.  
  349.                Table of factors and roots of unity.  See the description of
  350.                the _i_s_y_s argument for the value of _N_F and _N_F_R.
  351.  
  352.                If _i_s_i_g_n = 0, the routine initializes _t_a_b_l_e (_t_a_b_l_e is output
  353.                only).
  354.  
  355.                If _i_s_i_g_n = +1 or -1, the values in _t_a_b_l_e are assumed to be
  356.                initialized already by a prior call with _i_s_i_g_n = 0 (_t_a_b_l_e is
  357.                input only).
  358.  
  359.      _w_o_r_k      Array of dimension _n_1 + 4 * _n_2
  360.                SSSSCCCCFFFFFFFFTTTT2222DDDD, CCCCSSSSFFFFFFFFTTTT2222DDDD: Single precision array
  361.                DDDDZZZZFFFFFFFFTTTT2222DDDD, ZZZZDDDDFFFFFFFFTTTT2222DDDD: Double precision array
  362.  
  363.                Work array.  This is a scratch array used for intermediate
  364.                calculations.  Its address space must be different from that of
  365.                the input and output arrays.
  366.  
  367.      _i_s_y_s      Integer array dimensioned 0000........_i_s_y_s((((0000)))).
  368.                An array that gives implementation-specific information.  All
  369.                features and functions of the FFT routines specific to any
  370.                particular implementation are confined to this _i_s_y_s array.
  371.  
  372.                In the Origin series implementation, _i_s_y_s((((0000))))====0000 and _i_s_y_s((((0000))))====1111
  373.                are supported.  In SCSL versions prior to 1.3, only _i_s_y_s((((0000))))====0000
  374.                was allowed. For _i_s_y_s((((0000))))====0000, _N_F====33330000 and _N_F_R====11115555, and for
  375.                _i_s_y_s((((0000))))====1111, _N_F====_N_F_R====222255556666. The _N_F(_R) words of storage in the _t_a_b_l_e
  376.                array contain a factorization of the length of the transform.
  377.  
  378.                The smaller value of _N_F and _N_F_R for _i_s_y_s((((0000))))====0000 is historical.
  379.                They are too small to store all the required factors for the
  380.                highest performing FFT, so when _i_s_y_s((((0000))))====0000, extra space is
  381.                allocated when the _t_a_b_l_e array is initialized. To avoid memory
  382.                leaks, this extra space must be deallocated when the _t_a_b_l_e
  383.                array is no longer needed. The SSSSCCCCFFFFFFFFTTTT2222DDDDFFFF routine is used to
  384.                release this memory. Due to the potential for memory leaks, the
  385.                use of _i_s_y_s((((0000))))====0000 should be avoided.
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.                                                                         PPPPaaaaggggeeee 6666
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  400.  
  401.  
  402.  
  403.                For _i_s_y_s((((0000))))====1111, the value of _N_F and _N_F_R are large enough so that
  404.                no extra memory needs to be allocated, and there is no need to
  405.                call SSSSCCCCFFFFFFFFTTTT2222DDDDFFFF to release memory. If called, it does nothing.
  406.  
  407.                NOTE: _i_s_y_s((((0000))))====1111 means that _i_s_y_s is an integer array with two
  408.                elements. The second element, _i_s_y_s((((1111)))), will not be accessed.
  409.  
  410. NNNNOOOOTTTTEEEESSSS
  411.      The following data types are described in this documentation:
  412.  
  413.           TTTTeeeerrrrmmmm UUUUsssseeeedddd                     DDDDaaaattttaaaa ttttyyyyppppeeee
  414.  
  415.      Fortran:
  416.  
  417.           Array dimensioned 0000........_n----1111      xxxx((((0000::::nnnn----1111))))
  418.  
  419.           Array of dimensions (_m,_n)     xxxx((((mmmm,,,,nnnn))))
  420.  
  421.           Array of dimensions (_m,_n,_p)   xxxx((((mmmm,,,,nnnn,,,,pppp))))
  422.  
  423.           Integer                       IIIINNNNTTTTEEEEGGGGEEEERRRR (IIIINNNNTTTTEEEEGGGGEEEERRRR****8888 for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  424.  
  425.           Single precision              RRRREEEEAAAALLLL
  426.  
  427.           Double precision              DDDDOOOOUUUUBBBBLLLLEEEE PPPPRRRREEEECCCCIIIISSSSIIIIOOOONNNN
  428.  
  429.           Single precision complex      CCCCOOOOMMMMPPPPLLLLEEEEXXXX
  430.  
  431.           Double precision complex      DDDDOOOOUUUUBBBBLLLLEEEE CCCCOOOOMMMMPPPPLLLLEEEEXXXX
  432.  
  433.      C/C++:
  434.  
  435.           Array dimensioned 0000........_n----1111      xxxx[[[[_n]]]]
  436.  
  437.           Array of dimensions (_m,_n)     xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]]
  438.  
  439.           Array of dimensions (_m,_n,_p)   xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]]
  440.  
  441.           Integer                       iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  442.  
  443.           Single precision              ffffllllooooaaaatttt
  444.  
  445.           Double precision              ddddoooouuuubbbblllleeee
  446.  
  447.           Single precision complex      ssssccccssssllll____ccccoooommmmpppplllleeeexxxx
  448.  
  449.           Double precision complex      ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx
  450.  
  451.      C++ STL:
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.                                                                         PPPPaaaaggggeeee 7777
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  466.  
  467.  
  468.  
  469.           Array dimensioned 0000........_n----1111      xxxx[[[[_n]]]]
  470.  
  471.           Array of dimensions (_m,_n)     xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]]
  472.  
  473.           Array of dimensions (_m,_n,_p)   xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]]
  474.  
  475.           Integer                       iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]])
  476.  
  477.           Single precision              ffffllllooooaaaatttt
  478.  
  479.           Double precision              ddddoooouuuubbbblllleeee
  480.  
  481.           Single precision complex      ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>>
  482.  
  483.           Double precision complex      ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>>
  484.  
  485. CCCCAAAAUUUUTTTTIIIIOOOONNNNSSSS
  486.      Transform sizes with a prime factor exceeding 22223332222----1111 are not supported for
  487.      the 8-byte integer version of the library.
  488.  
  489.      In addition to the _w_o_r_k array, the FFT routines also dynamically allocate
  490.      scratch space from the stack. The amount of space allocated can be
  491.      slightly bigger than the size of the largest processor cache. For single
  492.      processor runs, the default stack size is large enough that these
  493.      allocations generally cause no problems. But for parallel runs, you need
  494.      to ensure that the stack size of slave threads is big enough to hold this
  495.      scratch space. Failure to reserve sufficient stack space will cause
  496.      programs to dump core due to stack overflows.  The stack size of MP
  497.      library slave threads is controlled via the MMMMPPPP____SSSSLLLLAAAAVVVVEEEE____SSSSTTTTAAAACCCCKKKKSSSSIIIIZZZZEEEE
  498.      environment variable or the mmmmpppp____sssseeeetttt____ssssllllaaaavvvveeee____ssssttttaaaacccckkkkssssiiiizzzzeeee(((()))) library routine. See
  499.      the mmmmpppp(3C), mmmmpppp(3F) and ppppeeee____eeeennnnvvvviiiirrrroooonnnn(5) reference pages for more information
  500.      on controlling the slave stack size. For pthreads applications, the
  501.      thread's stack size is specified as one of many creation attributes
  502.      provided in the pthread_attr_t argument to pppptttthhhhrrrreeeeaaaadddd____ccccrrrreeeeaaaatttteeee(3P).  The
  503.      stacksize attribute should be set explicitly to a non-default value using
  504.      the pppptttthhhhrrrreeeeaaaadddd____aaaattttttttrrrr____sssseeeettttssssttttaaaacccckkkkssssiiiizzzzeeee(3P) call, described in the
  505.      pppptttthhhhrrrreeeeaaaadddd____aaaattttttttrrrr____iiiinnnniiiitttt(3P) man page.
  506.  
  507.      Care must be exercised if copies of the _t_a_b_l_e array are used: even though
  508.      a copy exists, the original must persist. As an example, the following
  509.      code will nnnnooootttt work:
  510.  
  511.      #include <scsl_fft.h>
  512.      float x[256][129];
  513.      scsl_complex y[256][65];
  514.      float table[(128 + 256) + (2*256 + 256)];
  515.      float work[128 + 4*256];
  516.      int isys[2];
  517.      isys[0] = 1;
  518.      {
  519.        float table_orig[(128 + 256) + (2*256 + 256)];
  520.  
  521.  
  522.  
  523.  
  524.                                                                         PPPPaaaaggggeeee 8888
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  532.  
  533.  
  534.  
  535.        scfft2d(0, 128, 256, 1.0f, (float *) x, 129,
  536.             (scsl_complex *) y, 65, table_orig, work, isys);
  537.        bcopy(table_orig, table, ((128+256)+(2*256+256))*sizeof(float));
  538.      }
  539.      scfft2d(1, 128, 256, 1.0f, (float *) x, 129,
  540.             (scsl_complex *) y, 65, table, work, isys);
  541.  
  542.  
  543.      In this example, because _t_a_b_l_e__o_r_i_g is a stack variable that does not
  544.      persist outside of the code block delimited by the braces, the data in
  545.      the copy, _t_a_b_l_e, are not guaranteed to be valid. However, the following
  546.      code will work because _t_a_b_l_e__o_r_i_g is persistent:
  547.  
  548.      #include <scsl_fft.h>
  549.      float x[256][129];
  550.      scsl_complex y[256][65];
  551.      float table_orig[(128 + 256) + (2*256 + 256)];
  552.      float table[(128 + 256) + (2*256 + 256)];
  553.      float work[128 + 4*256];
  554.      int isys[2];
  555.      isys[0] = 1;
  556.      scfft2d(0, 128, 256, 1.0f, (float *) x, 129,
  557.             (scsl_complex *) y, 65, table_orig, work, isys);
  558.      bcopy(table_orig, table, ((128+256)+(2*256+256))*sizeof(float));
  559.      scfft2d(1, 128, 256, 1.0f, (float *) x, 129,
  560.             (scsl_complex *) y, 65, table, work, isys);
  561.  
  562.  
  563. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  564.      The following examples are for Origin series only.
  565.  
  566.      Example 1:  Initialize the TTTTAAAABBBBLLLLEEEE array in preparation for doing a two-
  567.      dimensional FFT of size 128 by 256.  In this case, only the _i_s_i_g_n, _n_1,
  568.      _n_2, and _t_a_b_l_e arguments are used; you can use dummy arguments or zeros
  569.      for other arguments.
  570.  
  571.      Fortran:
  572.  
  573.            REAL TABLE ((128 + 256) + (2*256 + 256))
  574.            INTEGER ISYS(0:1)
  575.            ISYS(0) = 1
  576.            CALL SCFFT2D (0, 128, 256, 0.0, DUMMY, 1, DUMMY, 1,
  577.           &              TABLE, DUMMY, ISYS)
  578.  
  579.  
  580.      Example 2:  XXXX is an array dimensioned (0...128, 0...255), and YYYY is a
  581.      complex array dimensioned (0...64, 0...255).  The first 128 elements of
  582.      each column of XXXX contain data; for performance reasons, the extra element
  583.      forces the leading dimension to be an odd number.  Take the
  584.      two-dimensional FFT of XXXX and store it in YYYY.  Initialize the TTTTAAAABBBBLLLLEEEE array,
  585.      as in example 1.
  586.  
  587.  
  588.  
  589.  
  590.                                                                         PPPPaaaaggggeeee 9999
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  598.  
  599.  
  600.  
  601.      Fortran:
  602.  
  603.      REAL    X(0:128, 0:255)
  604.      COMPLEX Y(0:64, 0:255)
  605.      REAL    TABLE ((128 + 256) + (2*256 + 256))
  606.      REAL    WORK(128 + 4*256)
  607.      INTEGER ISYS(0:1)
  608.      ISYS(0) = 1
  609.      CALL SCFFT2D(0, 128, 256, 1.0, X, 129, Y, 65, TABLE, WORK, ISYS)
  610.      CALL SCFFT2D(1, 128, 256, 1.0, X, 129, Y, 65, TABLE, WORK, ISYS)
  611.  
  612.  
  613.      C/C++:
  614.  
  615.           #include <scsl_fft.h>
  616.           float x[256][129];
  617.           scsl_complex y[256][65];
  618.           float table[(128 + 256) + (2*256 + 256)];
  619.           float work[128 + 4*256];
  620.           int isys[2];
  621.           isys[0] = 1;
  622.           scfft2d(0, 128, 256, 1.0f, (float *) x, 129,
  623.                  (scsl_complex *) y, 65, table, work, isys);
  624.           scfft2d(1, 128, 256, 1.0f, (float *) x, 129,
  625.                  (scsl_complex *) y, 65, table, work, isys);
  626.  
  627.  
  628.      C++ STL:
  629.  
  630.           #include <complex.h>
  631.           #include <scsl_fft.h>
  632.           float x[256][129];
  633.           complex<float> y[256][65];
  634.           float table[(128 + 256) + (2*256 + 256)];
  635.           float work[128 + 4*256];
  636.           int isys[2];
  637.           isys[0] = 1;
  638.           scfft2d(0, 128, 256, 1.0f, (float *) x, 129,
  639.                  (complex<float> *) y, 65, table, work, isys);
  640.           scfft2d(1, 128, 256, 1.0f, (float *) x, 129,
  641.                  (complex<float> *) y, 65, table, work, isys);
  642.  
  643.  
  644.      Example 3:  Take the inverse FFT of YYYY and store it back in XXXX.  Note that
  645.      the leading dimension of _X must be increased to 2 * _l_d_y.  The scale
  646.      factor 1.0/(128.0*256.0) is used.
  647.  
  648.      Fortran:
  649.  
  650.            REAL    X(0:129, 0:255)
  651.            COMPLEX Y(0:64, 0:255)
  652.            ...
  653.  
  654.  
  655.  
  656.                                                                        PPPPaaaaggggeeee 11110000
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  664.  
  665.  
  666.  
  667.            CALL CSFFT2D(-1, 128, 256, 1.0/(128.0*256.0), Y, 65,
  668.           &             X, 130, TABLE, WORK, ISYS)
  669.  
  670.  
  671.      C/C++:
  672.  
  673.      float x[256][129];
  674.      scsl_complex y[256][65];
  675.      csfft2d(-1, 128, 256, 1.0f/(128.0f*256.0f), (scsl_complex *) y,
  676.             65, (float *) x, 130, table, work, isys);
  677.  
  678.  
  679.      C++ STL:
  680.  
  681.      float x[256][129];
  682.      complex<float> y[256][65];
  683.      csfft2d(-1, 128, 256, 1.0f/(128.0f*256.0f), (complex<float> *) y,
  684.             65, (float *) x, 130, table, work, isys);
  685.  
  686.  
  687.      Example 4:  Perform the same computation as in example 2, but equivalence
  688.      the input and output arrays to save storage space.  In this case, a row
  689.      must be added to X, because it is equivalenced to a complex array.  Use
  690.      the 8-byte integer version of SCSL.
  691.  
  692.      Fortran:
  693.  
  694.            REAL    X(0:129, 0:255)
  695.            COMPLEX Y(0:64, 0:255)
  696.            EQUIVALENCE ( X(0, 0), Y(0, 0) )
  697.            REAL    TABLE ((128 + 256) + (2*256 + 256))
  698.            REAL    WORK(128 + 4*256)
  699.            INTEGER*8 ISYS(0:1)
  700.            ISYS(0) = 1_8
  701.            CALL SCFFT2D(0_8, 128_8, 256_8, 1.0, X, 130_8,
  702.           &             Y, 65_8, TABLE, WORK, ISYS)
  703.            CALL SCFFT2D(1_8, 128_8, 256_8, 1.0, X, 130_8,
  704.           &             Y, 65_8, TABLE, WORK, ISYS)
  705.  
  706.  
  707.      C/C++:
  708.  
  709.           #include <scsl_fft_i8.h>
  710.           float *x;
  711.           scsl_complex y[256][65];
  712.           float table[(128 + 256) + (2*256 + 256)];
  713.           float work[128 + 4*256];
  714.           long long isys[2];
  715.           isys[0] = 1LL;
  716.           x = (float *) &y[0][0];
  717.           scfft2d(0LL, 128LL, 256LL, 1.0f, x, 130LL,
  718.                   (scsl_complex *) y, 65LL, table, work, isys);
  719.  
  720.  
  721.  
  722.                                                                        PPPPaaaaggggeeee 11111111
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729. SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))                                                        SSSSCCCCFFFFFFFFTTTT2222DDDD((((3333SSSS))))
  730.  
  731.  
  732.  
  733.           scfft2d(1LL, 128LL, 256LL, 1.0f, x, 130LL,
  734.                   (scsl_complex *) y, 65LL, table, work, isys);
  735.  
  736.  
  737.      C++ STL:
  738.  
  739.           #include <complex.h>
  740.           #include <scsl_fft.h>
  741.           float *x;
  742.           complex<float> y[256][65];
  743.           float table[(128 + 256) + (2*256 + 256)];
  744.           float work[128 + 4*256];
  745.           long long isys[2];
  746.           isys[0] = 1LL;
  747.           x = (float *) &y[0][0];
  748.           scfft2d(0LL, 128LL, 256LL, 1.0f, x, 130LL,
  749.                   (complex<float> *) y, 65LL, table, work, isys);
  750.           scfft2d(1LL, 128LL, 256LL, 1.0f, x, 130LL,
  751.                   (complex<float> *) y, 65LL, table, work, isys);
  752.  
  753.  
  754.      Example 5:  Perform the same computation as in example 2, but assume that
  755.      the lower bound of each Fortran array is 1, rather than 0.  No change is
  756.      needed in the subroutine calls.
  757.  
  758.      Fortran:
  759.  
  760.      REAL    X(129, 256)
  761.      COMPLEX Y(65, 256)
  762.      CALL SCFFT2D(0, 128, 256, 1.0, X, 129, Y, 65, TABLE, WORK, ISYS)
  763.      CALL SCFFT2D(1, 128, 256, 1.0, X, 129, Y, 65, TABLE, WORK, ISYS)
  764.  
  765.  
  766. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  767.      IIIINNNNTTTTRRRROOOO____FFFFFFFFTTTT(3S), IIIINNNNTTTTRRRROOOO____SSSSCCCCSSSSLLLL(3S), CCCCCCCCFFFFFFFFTTTT(3S), CCCCCCCCFFFFFFFFTTTT2222DDDD(3S), CCCCCCCCFFFFFFFFTTTT3333DDDD(3S),
  768.      CCCCCCCCFFFFFFFFTTTTMMMM(3S), SSSSCCCCFFFFFFFFTTTT(3S), SSSSCCCCFFFFFFFFTTTT3333DDDD(3S), SSSSCCCCFFFFFFFFTTTTMMMM(3S)
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.                                                                        PPPPaaaaggggeeee 11112222
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.